<template>
	<view class="com-menu" :style="{'background-color': bgColor, 'border-radius': borderRadius + 'rpx'}">
		<com-grid :gap="gap" :data="data" :column="column">
			<template v-slot="{item, index}">
				<view class="y-flex y-align-center y-flex-1" @tap="handleTap(item)">
					<com-logo size="80" :src="item.icon" :color="item.iconColor"></com-logo>
					<com-text class="mt-10" lines="1" :value="item.title" size="28rpx" :color="color"></com-text>
				</view>
			</template>
		</com-grid>
	</view>
</template>

<script>
	export default {
		inject: ['getSkinColor', 'navigate'],
		props: {
			data: {
				type: Array,
				default () {
					return new Array
				}
			},
			options: {
				type: Object,
				default () {
					return new Object
				}
			},
			bgColor: {
				type: String,
				default: ''
			}
		},
		computed: {
			skinColor () {
				return this.getSkinColor()
			},
			column () {
				return this.options.column || 5
			},
			columnGap () {
				return this.options.column || 10
			},
			borderRadius () {
				return this.options.borderRadius
			},
			color () {
				return this.skinColor.color_1
			}
		},
		methods: {
			handleTap (item) {
				this.navigate(item.url)
			}
		}
	}
</script>

<style>
	.com-menu {
		padding: 20rpx 10rpx;
	}
</style>